home *** CD-ROM | disk | FTP | other *** search
/ Freelog 121 / FreelogMagazineJuilletAout2014-No121.iso / Outils / Adobe-Air / adobe-air_13.exe / [0] / setup.swf / scripts / mx / utils / ObjectUtil.as < prev    next >
Text File  |  2014-03-27  |  27KB  |  862 lines

  1. package mx.utils
  2. {
  3.    import flash.utils.ByteArray;
  4.    import flash.utils.Dictionary;
  5.    import flash.utils.getQualifiedClassName;
  6.    import flash.xml.XMLNode;
  7.    import mx.collections.IList;
  8.    import mx.core.mx_internal;
  9.    
  10.    use namespace mx_internal;
  11.    
  12.    public class ObjectUtil
  13.    {
  14.       
  15.       private static var defaultToStringExcludes:Array = ["password","credentials"];
  16.       
  17.       private static var CLASS_INFO_CACHE:Object = {};
  18.       
  19.       private static var refCount:int = 0;
  20.       
  21.       mx_internal static const VERSION:String = "3.0.0.0";
  22.        
  23.       
  24.       public function ObjectUtil()
  25.       {
  26.          super();
  27.       }
  28.       
  29.       public static function isSimple(param1:Object) : Boolean
  30.       {
  31.          var _loc2_:* = typeof param1;
  32.          switch(_loc2_)
  33.          {
  34.             case "number":
  35.             case "string":
  36.             case "boolean":
  37.                return true;
  38.             case "object":
  39.                return param1 is Date || param1 is Array;
  40.             default:
  41.                return false;
  42.          }
  43.       }
  44.       
  45.       private static function internalToString(param1:Object, param2:int = 0, param3:Dictionary = null, param4:Array = null, param5:Array = null) : String
  46.       {
  47.          var str:String = null;
  48.          var classInfo:Object = null;
  49.          var properties:Array = null;
  50.          var id:Object = null;
  51.          var isArray:Boolean = false;
  52.          var isDict:Boolean = false;
  53.          var prop:* = undefined;
  54.          var j:int = 0;
  55.          var value:Object = param1;
  56.          var indent:int = param2;
  57.          var refs:Dictionary = param3;
  58.          var namespaceURIs:Array = param4;
  59.          var exclude:Array = param5;
  60.          var type:String = value == null ? "null" : typeof value;
  61.          switch(type)
  62.          {
  63.             case "boolean":
  64.             case "number":
  65.                return value.toString();
  66.             case "string":
  67.                return "\"" + value.toString() + "\"";
  68.             case "object":
  69.                if(value is Date)
  70.                {
  71.                   return value.toString();
  72.                }
  73.                if(value is XMLNode)
  74.                {
  75.                   return value.toString();
  76.                }
  77.                if(value is Class)
  78.                {
  79.                   return "(" + getQualifiedClassName(value) + ")";
  80.                }
  81.                classInfo = getClassInfo(value,exclude,{
  82.                   "includeReadOnly":true,
  83.                   "uris":namespaceURIs
  84.                });
  85.                properties = classInfo.properties;
  86.                str = "(" + classInfo.name + ")";
  87.                if(refs == null)
  88.                {
  89.                   refs = new Dictionary(true);
  90.                }
  91.                id = refs[value];
  92.                if(id != null)
  93.                {
  94.                   str += "#" + int(id);
  95.                   return str;
  96.                }
  97.                if(value != null)
  98.                {
  99.                   str += "#" + refCount.toString();
  100.                   refs[value] = refCount;
  101.                   ++refCount;
  102.                }
  103.                isArray = value is Array;
  104.                isDict = value is Dictionary;
  105.                indent += 2;
  106.                j = 0;
  107.                while(j < properties.length)
  108.                {
  109.                   str = newline(str,indent);
  110.                   prop = properties[j];
  111.                   if(isArray)
  112.                   {
  113.                      str += "[";
  114.                   }
  115.                   else if(isDict)
  116.                   {
  117.                      str += "{";
  118.                   }
  119.                   if(isDict)
  120.                   {
  121.                      str += internalToString(prop,indent,refs,namespaceURIs,exclude);
  122.                   }
  123.                   else
  124.                   {
  125.                      str += prop.toString();
  126.                   }
  127.                   if(isArray)
  128.                   {
  129.                      str += "] ";
  130.                   }
  131.                   else if(isDict)
  132.                   {
  133.                      str += "} = ";
  134.                   }
  135.                   else
  136.                   {
  137.                      str += " = ";
  138.                   }
  139.                   try
  140.                   {
  141.                      str += internalToString(value[prop],indent,refs,namespaceURIs,exclude);
  142.                   }
  143.                   catch(e:Error)
  144.                   {
  145.                      str += "?";
  146.                   }
  147.                   j++;
  148.                }
  149.                indent -= 2;
  150.                return str;
  151.                break;
  152.             case "xml":
  153.                return value.toString();
  154.             default:
  155.                return "(" + type + ")";
  156.          }
  157.       }
  158.       
  159.       public static function getClassInfo(param1:Object, param2:Array = null, param3:Object = null) : Object
  160.       {
  161.          var n:int = 0;
  162.          var i:int = 0;
  163.          var result:Object = null;
  164.          var cacheKey:String = null;
  165.          var className:String = null;
  166.          var classAlias:String = null;
  167.          var properties:XMLList = null;
  168.          var prop:XML = null;
  169.          var metadataInfo:Object = null;
  170.          var classInfo:XML = null;
  171.          var numericIndex:Boolean = false;
  172.          var key:* = undefined;
  173.          var p:String = null;
  174.          var pi:Number = NaN;
  175.          var uris:Array = null;
  176.          var uri:String = null;
  177.          var qName:QName = null;
  178.          var j:int = 0;
  179.          var obj:Object = param1;
  180.          var excludes:Array = param2;
  181.          var options:Object = param3;
  182.          if(obj is ObjectProxy)
  183.          {
  184.             obj = ObjectProxy(obj).object_proxy::object;
  185.          }
  186.          if(options == null)
  187.          {
  188.             options = {
  189.                "includeReadOnly":true,
  190.                "uris":null,
  191.                "includeTransient":true
  192.             };
  193.          }
  194.          var propertyNames:Array = [];
  195.          var dynamic:Boolean = false;
  196.          if(typeof obj == "xml")
  197.          {
  198.             className = "XML";
  199.             properties = obj.text();
  200.             if(properties.length())
  201.             {
  202.                propertyNames.push("*");
  203.             }
  204.             properties = obj.attributes();
  205.          }
  206.          else
  207.          {
  208.             classInfo = DescribeTypeCache.describeType(obj).typeDescription;
  209.             className = classInfo.@name.toString();
  210.             classAlias = classInfo.@alias.toString();
  211.             dynamic = classInfo.@isDynamic.toString() == "true";
  212.             if(options.includeReadOnly)
  213.             {
  214.                properties = classInfo..accessor.(@access != "writeonly") + classInfo..variable;
  215.             }
  216.             else
  217.             {
  218.                properties = classInfo..accessor.(@access == "readwrite") + classInfo..variable;
  219.             }
  220.             numericIndex = false;
  221.          }
  222.          if(!dynamic)
  223.          {
  224.             cacheKey = getCacheKey(obj,excludes,options);
  225.             result = CLASS_INFO_CACHE[cacheKey];
  226.             if(result != null)
  227.             {
  228.                return result;
  229.             }
  230.          }
  231.          result = {};
  232.          result["name"] = className;
  233.          result["alias"] = classAlias;
  234.          result["properties"] = propertyNames;
  235.          result["dynamic"] = dynamic;
  236.          result["metadata"] = metadataInfo = recordMetadata(properties);
  237.          var excludeObject:Object = {};
  238.          if(excludes)
  239.          {
  240.             n = excludes.length;
  241.             i = 0;
  242.             while(i < n)
  243.             {
  244.                excludeObject[excludes[i]] = 1;
  245.                i++;
  246.             }
  247.          }
  248.          var isArray:Boolean = className == "Array";
  249.          var isDict:Boolean = className == "flash.utils::Dictionary";
  250.          if(isDict)
  251.          {
  252.             for(key in obj)
  253.             {
  254.                propertyNames.push(key);
  255.             }
  256.          }
  257.          else if(dynamic)
  258.          {
  259.             for(p in obj)
  260.             {
  261.                if(excludeObject[p] != 1)
  262.                {
  263.                   if(isArray)
  264.                   {
  265.                      pi = parseInt(p);
  266.                      if(isNaN(pi))
  267.                      {
  268.                         propertyNames.push(new QName("",p));
  269.                      }
  270.                      else
  271.                      {
  272.                         propertyNames.push(pi);
  273.                      }
  274.                   }
  275.                   else
  276.                   {
  277.                      propertyNames.push(new QName("",p));
  278.                   }
  279.                }
  280.             }
  281.             numericIndex = isArray && !isNaN(Number(p));
  282.          }
  283.          if(!(isArray || isDict || className == "Object"))
  284.          {
  285.             if(className == "XML")
  286.             {
  287.                n = properties.length();
  288.                i = 0;
  289.                while(i < n)
  290.                {
  291.                   p = properties[i].name();
  292.                   if(excludeObject[p] != 1)
  293.                   {
  294.                      propertyNames.push(new QName("","@" + p));
  295.                   }
  296.                   i++;
  297.                }
  298.             }
  299.             else
  300.             {
  301.                n = properties.length();
  302.                uris = options.uris;
  303.                i = 0;
  304.                while(i < n)
  305.                {
  306.                   prop = properties[i];
  307.                   p = prop.@name.toString();
  308.                   uri = prop.@uri.toString();
  309.                   if(excludeObject[p] != 1)
  310.                   {
  311.                      if(!(!options.includeTransient && internalHasMetadata(metadataInfo,p,"Transient")))
  312.                      {
  313.                         if(uris != null)
  314.                         {
  315.                            if(uris.length == 1 && uris[0] == "*")
  316.                            {
  317.                               qName = new QName(uri,p);
  318.                               try
  319.                               {
  320.                                  obj[qName];
  321.                                  propertyNames.push();
  322.                               }
  323.                               catch(e:Error)
  324.                               {
  325.                               }
  326.                            }
  327.                            else
  328.                            {
  329.                               j = 0;
  330.                               while(j < uris.length)
  331.                               {
  332.                                  uri = uris[j];
  333.                                  if(prop.@uri.toString() == uri)
  334.                                  {
  335.                                     qName = new QName(uri,p);
  336.                                     try
  337.                                     {
  338.                                        obj[qName];
  339.                                        propertyNames.push(qName);
  340.                                     }
  341.                                     catch(e:Error)
  342.                                     {
  343.                                     }
  344.                                  }
  345.                                  j++;
  346.                               }
  347.                            }
  348.                         }
  349.                         else if(uri.length == 0)
  350.                         {
  351.                            qName = new QName(uri,p);
  352.                            try
  353.                            {
  354.                               obj[qName];
  355.                               propertyNames.push(qName);
  356.                            }
  357.                            catch(e:Error)
  358.                            {
  359.                            }
  360.                         }
  361.                      }
  362.                   }
  363.                   i++;
  364.                }
  365.             }
  366.          }
  367.          propertyNames.sort(Array.CASEINSENSITIVE | (!!numericIndex ? Array.NUMERIC : 0));
  368.          if(!isDict)
  369.          {
  370.             i = 0;
  371.             while(i < propertyNames.length - 1)
  372.             {
  373.                if(propertyNames[i].toString() == propertyNames[i + 1].toString())
  374.                {
  375.                   propertyNames.splice(i,1);
  376.                   i--;
  377.                }
  378.                i++;
  379.             }
  380.          }
  381.          if(!dynamic)
  382.          {
  383.             cacheKey = getCacheKey(obj,excludes,options);
  384.             CLASS_INFO_CACHE[cacheKey] = result;
  385.          }
  386.          return result;
  387.       }
  388.       
  389.       private static function arrayCompare(param1:Array, param2:Array, param3:int, param4:int, param5:Dictionary) : int
  390.       {
  391.          var _loc7_:* = null;
  392.          var _loc6_:int = 0;
  393.          if(param1.length != param2.length)
  394.          {
  395.             if(param1.length < param2.length)
  396.             {
  397.                _loc6_ = -1;
  398.             }
  399.             else
  400.             {
  401.                _loc6_ = 1;
  402.             }
  403.          }
  404.          else
  405.          {
  406.             for(_loc7_ in param1)
  407.             {
  408.                if(!param2.hasOwnProperty(_loc7_))
  409.                {
  410.                   return -1;
  411.                }
  412.                if((_loc6_ = internalCompare(param1[_loc7_],param2[_loc7_],param3,param4,param5)) != 0)
  413.                {
  414.                   return _loc6_;
  415.                }
  416.             }
  417.             for(_loc7_ in param2)
  418.             {
  419.                if(!param1.hasOwnProperty(_loc7_))
  420.                {
  421.                   return 1;
  422.                }
  423.             }
  424.          }
  425.          return _loc6_;
  426.       }
  427.       
  428.       public static function stringCompare(param1:String, param2:String, param3:Boolean = false) : int
  429.       {
  430.          if(param1 == null && param2 == null)
  431.          {
  432.             return 0;
  433.          }
  434.          if(param1 == null)
  435.          {
  436.             return 1;
  437.          }
  438.          if(param2 == null)
  439.          {
  440.             return -1;
  441.          }
  442.          if(param3)
  443.          {
  444.             param1 = param1.toLocaleLowerCase();
  445.             param2 = param2.toLocaleLowerCase();
  446.          }
  447.          var _loc4_:int;
  448.          if((_loc4_ = param1.localeCompare(param2)) < -1)
  449.          {
  450.             _loc4_ = -1;
  451.          }
  452.          else if(_loc4_ > 1)
  453.          {
  454.             _loc4_ = 1;
  455.          }
  456.          return _loc4_;
  457.       }
  458.       
  459.       public static function dateCompare(param1:Date, param2:Date) : int
  460.       {
  461.          if(param1 == null && param2 == null)
  462.          {
  463.             return 0;
  464.          }
  465.          if(param1 == null)
  466.          {
  467.             return 1;
  468.          }
  469.          if(param2 == null)
  470.          {
  471.             return -1;
  472.          }
  473.          var _loc3_:Number = param1.getTime();
  474.          var _loc4_:Number = param2.getTime();
  475.          if(_loc3_ < _loc4_)
  476.          {
  477.             return -1;
  478.          }
  479.          if(_loc3_ > _loc4_)
  480.          {
  481.             return 1;
  482.          }
  483.          return 0;
  484.       }
  485.       
  486.       public static function numericCompare(param1:Number, param2:Number) : int
  487.       {
  488.          if(isNaN(param1) && isNaN(param2))
  489.          {
  490.             return 0;
  491.          }
  492.          if(isNaN(param1))
  493.          {
  494.             return 1;
  495.          }
  496.          if(isNaN(param2))
  497.          {
  498.             return -1;
  499.          }
  500.          if(param1 < param2)
  501.          {
  502.             return -1;
  503.          }
  504.          if(param1 > param2)
  505.          {
  506.             return 1;
  507.          }
  508.          return 0;
  509.       }
  510.       
  511.       private static function newline(param1:String, param2:int = 0) : String
  512.       {
  513.          var _loc3_:* = param1;
  514.          _loc3_ += "\n";
  515.          var _loc4_:int = 0;
  516.          while(_loc4_ < param2)
  517.          {
  518.             _loc3_ += " ";
  519.             _loc4_++;
  520.          }
  521.          return _loc3_;
  522.       }
  523.       
  524.       private static function recordMetadata(param1:XMLList) : Object
  525.       {
  526.          var prop:XML = null;
  527.          var propName:String = null;
  528.          var metadataList:XMLList = null;
  529.          var metadata:Object = null;
  530.          var md:XML = null;
  531.          var mdName:String = null;
  532.          var argsList:XMLList = null;
  533.          var value:Object = null;
  534.          var arg:XML = null;
  535.          var existing:Object = null;
  536.          var argKey:String = null;
  537.          var argValue:String = null;
  538.          var existingArray:Array = null;
  539.          var properties:XMLList = param1;
  540.          var result:Object = null;
  541.          try
  542.          {
  543.             for each(prop in properties)
  544.             {
  545.                propName = prop.attribute("name").toString();
  546.                metadataList = prop.metadata;
  547.                if(metadataList.length() > 0)
  548.                {
  549.                   if(result == null)
  550.                   {
  551.                      result = {};
  552.                   }
  553.                   metadata = {};
  554.                   result[propName] = metadata;
  555.                   for each(md in metadataList)
  556.                   {
  557.                      mdName = md.attribute("name").toString();
  558.                      argsList = md.arg;
  559.                      value = {};
  560.                      for each(arg in argsList)
  561.                      {
  562.                         argKey = arg.attribute("key").toString();
  563.                         if(argKey != null)
  564.                         {
  565.                            argValue = arg.attribute("value").toString();
  566.                            value[argKey] = argValue;
  567.                         }
  568.                      }
  569.                      existing = metadata[mdName];
  570.                      if(existing != null)
  571.                      {
  572.                         if(existing is Array)
  573.                         {
  574.                            existingArray = existing as Array;
  575.                         }
  576.                         else
  577.                         {
  578.                            existingArray = [];
  579.                         }
  580.                         existingArray.push(value);
  581.                         existing = existingArray;
  582.                      }
  583.                      else
  584.                      {
  585.                         existing = value;
  586.                      }
  587.                      metadata[mdName] = existing;
  588.                   }
  589.                }
  590.             }
  591.          }
  592.          catch(e:Error)
  593.          {
  594.          }
  595.          return result;
  596.       }
  597.       
  598.       public static function compare(param1:Object, param2:Object, param3:int = -1) : int
  599.       {
  600.          return internalCompare(param1,param2,0,param3,new Dictionary(true));
  601.       }
  602.       
  603.       private static function listCompare(param1:IList, param2:IList, param3:int, param4:int, param5:Dictionary) : int
  604.       {
  605.          var _loc7_:int = 0;
  606.          var _loc6_:int = 0;
  607.          if(param1.length != param2.length)
  608.          {
  609.             if(param1.length < param2.length)
  610.             {
  611.                _loc6_ = -1;
  612.             }
  613.             else
  614.             {
  615.                _loc6_ = 1;
  616.             }
  617.          }
  618.          else
  619.          {
  620.             _loc7_ = 0;
  621.             while(_loc7_ < param1.length)
  622.             {
  623.                if((_loc6_ = internalCompare(param1.getItemAt(_loc7_),param2.getItemAt(_loc7_),param3 + 1,param4,param5)) != 0)
  624.                {
  625.                   _loc7_ = param1.length;
  626.                }
  627.                _loc7_++;
  628.             }
  629.          }
  630.          return _loc6_;
  631.       }
  632.       
  633.       private static function internalCompare(param1:Object, param2:Object, param3:int, param4:int, param5:Dictionary) : int
  634.       {
  635.          var _loc9_:int = 0;
  636.          var _loc10_:Boolean = false;
  637.          var _loc11_:Boolean = false;
  638.          var _loc12_:Array = null;
  639.          var _loc13_:Array = null;
  640.          var _loc14_:QName = null;
  641.          var _loc15_:Object = null;
  642.          var _loc16_:Object = null;
  643.          var _loc17_:int = 0;
  644.          if(param1 == null && param2 == null)
  645.          {
  646.             return 0;
  647.          }
  648.          if(param1 == null)
  649.          {
  650.             return 1;
  651.          }
  652.          if(param2 == null)
  653.          {
  654.             return -1;
  655.          }
  656.          if(param1 is ObjectProxy)
  657.          {
  658.             param1 = ObjectProxy(param1).object_proxy::object;
  659.          }
  660.          if(param2 is ObjectProxy)
  661.          {
  662.             param2 = ObjectProxy(param2).object_proxy::object;
  663.          }
  664.          var _loc6_:* = typeof param1;
  665.          var _loc7_:* = typeof param2;
  666.          var _loc8_:int = 0;
  667.          if(_loc6_ == _loc7_)
  668.          {
  669.             switch(_loc6_)
  670.             {
  671.                case "boolean":
  672.                   _loc8_ = numericCompare(Number(param1),Number(param2));
  673.                   break;
  674.                case "number":
  675.                   _loc8_ = numericCompare(param1 as Number,param2 as Number);
  676.                   break;
  677.                case "string":
  678.                   _loc8_ = stringCompare(param1 as String,param2 as String);
  679.                   break;
  680.                case "object":
  681.                   _loc9_ = param4 > 0 ? int(param4 - 1) : int(param4);
  682.                   _loc10_ = param5[param1];
  683.                   _loc11_ = param5[param2];
  684.                   if(_loc10_ && !_loc11_)
  685.                   {
  686.                      return 1;
  687.                   }
  688.                   if(_loc11_ && !_loc10_)
  689.                   {
  690.                      return -1;
  691.                   }
  692.                   if(_loc11_ && _loc10_)
  693.                   {
  694.                      return 0;
  695.                   }
  696.                   param5[param1] = true;
  697.                   param5[param2] = true;
  698.                   if(param4 != -1 && param3 > param4)
  699.                   {
  700.                      _loc8_ = stringCompare(param1.toString(),param2.toString());
  701.                   }
  702.                   else if(param1 is Array && param2 is Array)
  703.                   {
  704.                      _loc8_ = arrayCompare(param1 as Array,param2 as Array,param3,param4,param5);
  705.                   }
  706.                   else if(param1 is Date && param2 is Date)
  707.                   {
  708.                      _loc8_ = dateCompare(param1 as Date,param2 as Date);
  709.                   }
  710.                   else if(param1 is IList && param2 is IList)
  711.                   {
  712.                      _loc8_ = listCompare(param1 as IList,param2 as IList,param3,param4,param5);
  713.                   }
  714.                   else if(param1 is ByteArray && param2 is ByteArray)
  715.                   {
  716.                      _loc8_ = byteArrayCompare(param1 as ByteArray,param2 as ByteArray);
  717.                   }
  718.                   else
  719.                   {
  720.                      if(getQualifiedClassName(param1) != getQualifiedClassName(param2))
  721.                      {
  722.                         return 1;
  723.                      }
  724.                      _loc12_ = getClassInfo(param1).properties;
  725.                      if(getQualifiedClassName(param1) == "Object")
  726.                      {
  727.                         _loc13_ = getClassInfo(param2).properties;
  728.                         _loc8_ = arrayCompare(_loc12_,_loc13_,param3,_loc9_,param5);
  729.                      }
  730.                      if(_loc8_ != 0)
  731.                      {
  732.                         return _loc8_;
  733.                      }
  734.                      _loc17_ = 0;
  735.                      while(_loc17_ < _loc12_.length)
  736.                      {
  737.                         _loc14_ = _loc12_[_loc17_];
  738.                         _loc15_ = param1[_loc14_];
  739.                         _loc16_ = param2[_loc14_];
  740.                         if((_loc8_ = internalCompare(_loc15_,_loc16_,param3 + 1,_loc9_,param5)) != 0)
  741.                         {
  742.                            _loc17_ = _loc12_.length;
  743.                         }
  744.                         _loc17_++;
  745.                      }
  746.                   }
  747.                   break;
  748.             }
  749.             return _loc8_;
  750.          }
  751.          return stringCompare(_loc6_,_loc7_);
  752.       }
  753.       
  754.       public static function hasMetadata(param1:Object, param2:String, param3:String, param4:Array = null, param5:Object = null) : Boolean
  755.       {
  756.          var _loc6_:Object;
  757.          var _loc7_:Object = (_loc6_ = getClassInfo(param1,param4,param5))["metadata"];
  758.          return internalHasMetadata(_loc7_,param2,param3);
  759.       }
  760.       
  761.       private static function internalHasMetadata(param1:Object, param2:String, param3:String) : Boolean
  762.       {
  763.          var _loc4_:Object = null;
  764.          if(param1 != null)
  765.          {
  766.             if((_loc4_ = param1[param2]) != null)
  767.             {
  768.                if(_loc4_[param3] != null)
  769.                {
  770.                   return true;
  771.                }
  772.             }
  773.          }
  774.          return false;
  775.       }
  776.       
  777.       public static function toString(param1:Object, param2:Array = null, param3:Array = null) : String
  778.       {
  779.          if(param3 == null)
  780.          {
  781.             param3 = defaultToStringExcludes;
  782.          }
  783.          refCount = 0;
  784.          return internalToString(param1,0,null,param2,param3);
  785.       }
  786.       
  787.       private static function byteArrayCompare(param1:ByteArray, param2:ByteArray) : int
  788.       {
  789.          var _loc4_:int = 0;
  790.          var _loc3_:int = 0;
  791.          if(param1.length != param2.length)
  792.          {
  793.             if(param1.length < param2.length)
  794.             {
  795.                _loc3_ = -1;
  796.             }
  797.             else
  798.             {
  799.                _loc3_ = 1;
  800.             }
  801.          }
  802.          else
  803.          {
  804.             param1.position = 0;
  805.             param2.position = 0;
  806.             _loc4_ = 0;
  807.             while(_loc4_ < param1.length)
  808.             {
  809.                _loc3_ = numericCompare(param1.readByte(),param2.readByte());
  810.                if(_loc3_ != 0)
  811.                {
  812.                   _loc4_ = param1.length;
  813.                }
  814.                _loc4_++;
  815.             }
  816.          }
  817.          return _loc3_;
  818.       }
  819.       
  820.       public static function copy(param1:Object) : Object
  821.       {
  822.          var _loc2_:ByteArray = new ByteArray();
  823.          _loc2_.writeObject(param1);
  824.          _loc2_.position = 0;
  825.          return _loc2_.readObject();
  826.       }
  827.       
  828.       private static function getCacheKey(param1:Object, param2:Array = null, param3:Object = null) : String
  829.       {
  830.          var _loc5_:uint = 0;
  831.          var _loc6_:String = null;
  832.          var _loc7_:* = null;
  833.          var _loc8_:String = null;
  834.          var _loc4_:String = getQualifiedClassName(param1);
  835.          if(param2 != null)
  836.          {
  837.             _loc5_ = 0;
  838.             while(_loc5_ < param2.length)
  839.             {
  840.                if((_loc6_ = param2[_loc5_] as String) != null)
  841.                {
  842.                   _loc4_ += _loc6_;
  843.                }
  844.                _loc5_++;
  845.             }
  846.          }
  847.          if(param3 != null)
  848.          {
  849.             for(_loc7_ in param3)
  850.             {
  851.                _loc4_ += _loc7_;
  852.                if((_loc8_ = param3[_loc7_] as String) != null)
  853.                {
  854.                   _loc4_ += _loc8_;
  855.                }
  856.             }
  857.          }
  858.          return _loc4_;
  859.       }
  860.    }
  861. }
  862.